package com.chattingroom.mqproducer.mqproducer.feign.interfaces;

import com.rabbitmq.ChattingRoom.util.common.req.SendMessageToQueueReq;
import com.rabbitmq.ChattingRoom.util.common.req.TellUserQuitChattingRoomReq;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;


@FeignClient(name = "chattingroom-mq-producer")
public interface MyProducerFeign {

    /**
     * 创建 queue 方法
     */
    @PostMapping(value = "/feign/producer/queue/create/{queueName}")
    boolean createQueue(@PathVariable("queueName") String queueName);

    /**
     * 给指定 queue 发送消息
     */
    @PostMapping(value = "/feign/producer/queue/sendmsg")
    boolean sendMessageToQueue(@RequestBody SendMessageToQueueReq req);

    /**
     * 给指定 queue 发送消息,消息类型主要用于通知用户已被移出聊天室
     */
    @PostMapping(value = "/feign/producer/queue/sendQuitMsg")
    boolean sendQuitMessageToQueue(@RequestBody TellUserQuitChattingRoomReq req);

    /**
     * 根据 queueName (roomId) 删除queue
     */
    @PostMapping(value = "/feign/producer/queue/delete/{queueName}")
    boolean deleteByQueueName(@PathVariable("queueName") String queueName);

}
